import redis

#定义地址和端口
host = '127.0.0.1'
# host = '192.168.99.100'       #docker路径下的ip
port = 6379
# port = 6380       #docker路径下的端口号
#建立redis链接
r = redis.Redis(host=host,port=port)

#声明一个值
r.set('test','123')

#取值
code = r.get('test')

#转码
code = code.decode('utf-8')

print(code)